package com.ruibang.glass.quality.controller;

import com.ruibang.glass.quality.constant.Constants;
import com.ruibang.glass.quality.domain.req.DefectSizeDataReq;
import com.ruibang.glass.quality.domain.req.DiscardDefectDataReq;
import com.ruibang.glass.quality.domain.req.LayeredPointDataReq;
import com.ruibang.glass.quality.service.DiscardDefectDataService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.Arrays;

/**
 * @Author: songJinKang
 * @CreateTime: 2023-08-31  09:35
 * @Description: TODO:缺陷判废数据控制器
 * @Version: 1.0
 */

@RestController
@RequestMapping("/api/defect/discard")
@Api(value = "缺陷判废数据控制器(冷端)", tags = {"缺陷判废数据控制器（冷端）"})
public class DiscardDefectDataController {

    @Autowired
    private DiscardDefectDataService discardDefectDataService;

    @PostMapping("/queryColdDirect")
    @ApiOperation(value = "溶解缺陷map图", notes = "溶解缺陷map图")
    public ResultBody queryDefectMapData(@RequestBody @Valid DiscardDefectDataReq discardDefectDataReq) {
        return discardDefectDataService.queryDefectMapData(discardDefectDataReq);
    }

    @PostMapping("/querySizePointData")
    @ApiOperation(value = "判废的气泡、结石、铂金的尺寸图", notes = "判废的气泡、结石、铂金的尺寸图")
    public ResultBody queryDefectSizeData(@RequestBody @Valid DefectSizeDataReq defectSizeDataReq) {
        return discardDefectDataService.queryDefectSizeData(defectSizeDataReq);
    }

    @PostMapping("/queryLayeredPointData")
    @ApiOperation(value = "判废的气泡、结石、铂金的层面分布图", notes = "判废的气泡、结石、铂金的层面分布图")
    public ResultBody queryLayeredPointData(@RequestBody @Valid LayeredPointDataReq layeredPointDataReq) {
        return discardDefectDataService.queryLayeredPointData(layeredPointDataReq);
    }

    @GetMapping("/getDefectList")
    @ApiOperation(value = "获取缺陷列表", notes = "获取缺陷列表")
    public ResultBody getDefectList() {
        return discardDefectDataService.getDefectList();
    }

    @GetMapping("/getTotalDefectList")
    @ApiOperation(value = "获取缺陷总类型", notes = "获取缺陷总类型")
    public ResultBody getTotalDefectList() {
        return ResultBody.success(Arrays.asList(Constants.DEFECT_PT, Constants.DEFECT_BUBBLE, Constants.DEFECT_STONE));
    }
}
